package com.powernode.transaction;

import com.powernode.commons.util.DbUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

@SuppressWarnings("all")
/**
 * @Author Arrebol
 * @Date 2024/8/2 19:03
 * @Project jdbc
 * @Description：
 * 使用Java代码设置事务隔离级别
 */
public class JdbcTest3 {
    public static void main(String[] args) {
        Connection conn=null;
        try {
            conn = DbUtils.getConnection();
            //设置事务隔离级别
            conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DbUtils.close(null,null,conn);
        }
    }
}
